home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / libkcal / event.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-02-13  |  3.5 KB  |  136 lines

  1. /*
  2.     This file is part of libkcal.
  3.  
  4.     Copyright (c) 2001-2003 Cornelius Schumacher <schumacher@kde.org>
  5.  
  6.     This library is free software; you can redistribute it and/or
  7.     modify it under the terms of the GNU Library General Public
  8.     License as published by the Free Software Foundation; either
  9.     version 2 of the License, or (at your option) any later version.
  10.  
  11.     This library is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.     Library General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU Library General Public License
  17.     along with this library; see the file COPYING.LIB.  If not, write to
  18.     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19.     Boston, MA 02110-1301, USA.
  20. */
  21. #ifndef KCAL_EVENT_H
  22. #define KCAL_EVENT_H
  23.  
  24. #include "incidence.h"
  25. #include <kdepimmacros.h>
  26.  
  27. namespace KCal {
  28.  
  29. /**
  30.   This class provides an Event in the sense of RFC2445.
  31. */
  32. class LIBKCAL_EXPORT Event : public Incidence
  33. {
  34.   public:
  35.     /**
  36.       Transparency of event.
  37.  
  38.       Opaque      - event appears in free/busy time
  39.       Transparent - event doesn't appear in free/busy time
  40.     */
  41.     enum Transparency { Opaque, Transparent };
  42.  
  43.     typedef ListBase<Event> List;
  44.  
  45.     Event();
  46.     Event( const Event & );
  47.     ~Event();
  48.     Event& operator=( const Event &e );
  49.     bool operator==( const Event & ) const;
  50.  
  51.     QCString type() const { return "Event"; }
  52.  
  53.     /**
  54.       Return copy of this Event. The caller owns the returned objet.
  55.     */
  56.     Event *clone();
  57.  
  58.     /**
  59.       Set end date and time.
  60.     */
  61.     void setDtEnd(const QDateTime &dtEnd);
  62.     /**
  63.       Return end date and time.
  64.     */
  65.     virtual QDateTime dtEnd() const;
  66.     /**
  67.       Returns the day when the event ends. This might be different from
  68.       dtEnd().date, since the end date/time is non-inclusive. So timed events
  69.       ending at 0:00 have their end date on the day before.
  70.     */
  71.     QDate dateEnd() const;
  72.     /**
  73.       Return end time as string formatted according to the users locale
  74.       settings.
  75.     */
  76.     QString dtEndTimeStr() const;
  77.     /**
  78.       Return end date as string formatted according to the users locale
  79.       settings.
  80.  
  81.       @param shortfmt if true return string in short format, if false return
  82.                       long format
  83.     */
  84.     QString dtEndDateStr( bool shortfmt = true ) const;
  85.     /**
  86.       Return end date and time as string formatted according to the users locale
  87.       settings.
  88.     */
  89.     QString dtEndStr() const;
  90.  
  91.     /**
  92.       Set whether the event has an end date/time.
  93.     */
  94.     void setHasEndDate(bool);
  95.     /**
  96.       Return whether the event has an end date/time.
  97.     */
  98.     bool hasEndDate() const;
  99.  
  100.     /**
  101.       Return true if the event spans multiple days, otherwise return false.
  102.     */
  103.     bool isMultiDay() const;
  104.  
  105.     /**
  106.       Set the event's time transparency level.
  107.     */
  108.     void setTransparency( Transparency transparency );
  109.     /**
  110.       Return the event's time transparency level.
  111.     */
  112.     Transparency transparency() const;
  113.  
  114.     /**
  115.       Set duration of this event.
  116.     */
  117.     void setDuration( int seconds );
  118.  
  119.   protected:
  120.     /** Return the end date/time of the base incidence. */
  121.     virtual QDateTime endDateRecurrenceBase() const { return dtEnd(); }
  122.   private:
  123.     bool accept( Visitor &v ) { return v.visit( this ); }
  124.  
  125.     QDateTime mDtEnd;
  126.     bool mHasEndDate;
  127.     Transparency mTransparency;
  128.  
  129.     class Private;
  130.     Private *d;
  131. };
  132.  
  133. }
  134.  
  135. #endif
  136.